# -*-  coding:utf-8 -*- 
# Author : lihongliang

import  logging
logger = logging.getLogger("webtest")
logger.setLevel(logging.DEBUG)

ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
fh = logging.FileHandler("webtest.log")
fh.setLevel(logging.WARNING)

logger.addHandler(ch)
logger.addHandler(fh)

file_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(lineno)d - %(message)s')

fh.setFormatter(file_formatter)
ch.setFormatter(console_formatter)

logger.debug("test_log")
logger.info("test_info")
logger.warning("test_warning")
logger.error("test_error")